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