UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'okQ2qNsOStCcXaGV6BqN88HVhliFObQu3XFzbTAd2sk='
WHERE
key_id = '02c15685a8d0baa8568c1ba38fa366e7475b0c205c04003700a870a41257963d'
AND (
token = 'okQ2qNsOStCcXaGV6BqN88HVhliFObQu3XFzbTAd2sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)