UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rqplbv8S4TIPZj2K5vtn8SYhaizQimFlCO0WUo/8BMQ=' 
WHERE 
  key_id = '116c688807e51840e6297e075530d415acd96303cb75dd65298144c604acdbb7' 
  AND (
    token = 'Rqplbv8S4TIPZj2K5vtn8SYhaizQimFlCO0WUo/8BMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029