UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ibCYFkbbpj+n9Hb8yUnnh8SnZqgn/dd8+y8E38VlI/E=' 
WHERE 
  key_id = 'b900d22ed1ec41602c717ede4b971b33969c2e11e8da720a656d92c4fd14fb80' 
  AND (
    token = 'ibCYFkbbpj+n9Hb8yUnnh8SnZqgn/dd8+y8E38VlI/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033