UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A+tkZjL8LtKUiPX6YuVRPraHniA83LUXuL2pKGFrV3s='
WHERE
key_id = '3a8a9e64465bbac000436332857fa5889b51929d850eb44ed16d5e4bbd6a98b2'
AND (
token = 'A+tkZjL8LtKUiPX6YuVRPraHniA83LUXuL2pKGFrV3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)