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