UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z7YC9NToHWH8tN2RFIAlkVxVSqhDcJBuHVXuGpw6/kE='
WHERE
key_id = 'd4befc85a447f2cf9be51520c90897a18725e96873c3c8be1bc38003e0bc8a39'
AND (
token = 'z7YC9NToHWH8tN2RFIAlkVxVSqhDcJBuHVXuGpw6/kE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)