UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pnrBY8dFEqq3J3sp5bBRbpnnF9W8hWA25aeKjShHkq8='
WHERE
key_id = 'e4d03fcdd6d8f3cc8d7c16358b06883f52270483be915f9aec644b45e5c4a27c'
AND (
token = 'pnrBY8dFEqq3J3sp5bBRbpnnF9W8hWA25aeKjShHkq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)