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