UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UVsMIrgkznC5sCWzlTl0Y/xFwr+92adSj3/LJSv6/Y0=' 
WHERE 
  key_id = '9e669c3715aee98322d2e8b0dda84875c83f5ce6b62970aa42a0ff03938886f2' 
  AND (
    token = 'UVsMIrgkznC5sCWzlTl0Y/xFwr+92adSj3/LJSv6/Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034