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

Query time 0.00026