UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2n7/NGSqKauzBpgTy9dBk5bcACSTnI9pBk80gS7MRz0='
WHERE
key_id = 'c57fe9887f05479bb6ccbe705f3f7f0ad7aa165df9549289f178c2394cd85abb'
AND (
token = '2n7/NGSqKauzBpgTy9dBk5bcACSTnI9pBk80gS7MRz0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)