UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ckr8ShA/A9+MoKqfhADlsn+/qFmOyxYaTvfsNn2Zay0='
WHERE
key_id = 'a5660a8df1d6f876dca65d1eeba75951ebe90f536124b52eae13e09e9a0251b7'
AND (
token = 'Ckr8ShA/A9+MoKqfhADlsn+/qFmOyxYaTvfsNn2Zay0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)