UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A3wCPLK2F/UE42E5TjwcRLB6oM4OUPnuOYK1hD18yMg='
WHERE
key_id = 'c16d47b36d4814764f91c1380ee5d4c2a48c8659e2acb7a9ad992cf93a6ed4a8'
AND (
token = 'A3wCPLK2F/UE42E5TjwcRLB6oM4OUPnuOYK1hD18yMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)