UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kDfHhPrLTyXVXom099jtINGItwBYoOvvrXQ/iLaYiaQ=' 
WHERE 
  key_id = '6d309631cc2f779b3c00314450bab9ead118974149b085095c293304abd283d8' 
  AND (
    token = 'kDfHhPrLTyXVXom099jtINGItwBYoOvvrXQ/iLaYiaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032