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