UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AUqxDOkdqHFygwiF0qdsoEsFIVSkf1CBFI0OgZX9eNc=' 
WHERE 
  key_id = '7bfcff16d5cae955900a18a78f8c30d039feb9b247616fb4ce5b2a67ae8f78d1' 
  AND (
    token = 'AUqxDOkdqHFygwiF0qdsoEsFIVSkf1CBFI0OgZX9eNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031