UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zp8dno5yXouclBxF2XCik3tiPEW7rWufCAnGyrebVv4=' 
WHERE 
  key_id = 'a1b3dccf370639e0e0afdeb1912319d3e072d3f3270998fc662f7367939b12e7' 
  AND (
    token = 'Zp8dno5yXouclBxF2XCik3tiPEW7rWufCAnGyrebVv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046