UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1EmYt2f80pZC9IgoRT4VK7IGni3O3kJAsEWXuc24inQ='
WHERE
key_id = 'b8befe47f226b135a404b74e32d8ef5a499b7089a41ea1094e2cde9a258e1a30'
AND (
token = '1EmYt2f80pZC9IgoRT4VK7IGni3O3kJAsEWXuc24inQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)