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