UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9CFSaHMjj5dTeF1zvyMNL1fCU0u9goxlCZstgX5/YQ=' 
WHERE 
  key_id = 'f436acb6c787815a3d8674f5f6036d209c2398393d0e5c20638aa6f3bfc4fd74' 
  AND (
    token = 'n9CFSaHMjj5dTeF1zvyMNL1fCU0u9goxlCZstgX5/YQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026