UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KS9WfPcsfhEbi1PmQ0YJt5YwniQzsq2Xkn7e4BFhXo0='
WHERE
key_id = '602b12eddb70d2f39fff577fec369c45e47caf6f72c3a2385c4f414f02ec64cb'
AND (
token = 'KS9WfPcsfhEbi1PmQ0YJt5YwniQzsq2Xkn7e4BFhXo0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)