UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tTFmxy+/y4r/pawY8f+p88b10WarQRKO34X9gNBYh0k=' 
WHERE 
  key_id = 'e040c31a4ac126575d5067385fd9e1549e540ff69b3b25fd1cc635960553809b' 
  AND (
    token = 'tTFmxy+/y4r/pawY8f+p88b10WarQRKO34X9gNBYh0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021