UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZZyryNepCAbcLae9TRL7AyWn+zODn0gfaJPnuhVyld8='
WHERE
key_id = '39ca8fa9e53cbd3997d654f3b434e2247d6c7f5031176e8f93acb6ace19131ac'
AND (
token = 'ZZyryNepCAbcLae9TRL7AyWn+zODn0gfaJPnuhVyld8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)