UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9D9FsJemS0hFXkB1rbJE3IMnESmZ/2mThInKvibXVTk='
WHERE
key_id = '76e1c71aab87a07055287618fcabeae6f3cb76cfb0fe1db75d1642d4b248519d'
AND (
token = '9D9FsJemS0hFXkB1rbJE3IMnESmZ/2mThInKvibXVTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)