UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EbPdRI1Rg1BaUcVQWguQ8/DbXgDzUqF86B3PZQuRWJ4=' 
WHERE 
  key_id = '521d7527afb8148229b40d84611d8a9ce0c219a99e81b606e827762c5533dce6' 
  AND (
    token = 'EbPdRI1Rg1BaUcVQWguQ8/DbXgDzUqF86B3PZQuRWJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061