UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z6QjyOxtWFOCWegL0ZOdExhFHshT6PVvi+Buvux6e1Y='
WHERE
key_id = 'b58277f1195eef9496425f1e6913ddd94df0bd3e7bb87614c115af438953c080'
AND (
token = 'Z6QjyOxtWFOCWegL0ZOdExhFHshT6PVvi+Buvux6e1Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)