UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gpK6KXqYcffK4i/lDQ8KUNTuOjZHK0pZbuiQlJfhB4U='
WHERE
key_id = '00cc46b3d2a0464457356e0205af50d85159eb516ad0232567816ed30d00729a'
AND (
token = 'gpK6KXqYcffK4i/lDQ8KUNTuOjZHK0pZbuiQlJfhB4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)